package start.spring.basic.job.service.demo.impl;

import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;

import lombok.extern.slf4j.Slf4j;
import start.spring.basic.exinterface.feignapi.InterfaceVersionApi;
import start.spring.basic.job.feignclient.InterfaceVersionFeignClient;
import start.spring.basic.job.service.BaseServiceImpl;
import start.spring.basic.job.service.demo.IDemoService;
import start.spring.basic.log.LogConstant;
import start.spring.basic.response.ResponseData;

/**
 * 
 * ****************************************************************************
 * 开发样例业务逻辑实现
 *
 * @author(作者)：xuyongyun	
 * @date(创建日期)：2021年4月8日
 ******************************************************************************
 */
@Slf4j
@Service
public class DemoServiceImpl extends BaseServiceImpl implements IDemoService {
	
	@Autowired
	InterfaceVersionApi interfaceVersionApi;
	
	@Autowired
	InterfaceVersionFeignClient interfaceVersionFeignClient;
	
	@Override
	public void queryInterfaceVersionFromApi() {
		ResponseData<String> resultData = interfaceVersionApi.testVersion(MDC.get(LogConstant.REQUEST_KEY_TRACEID).toString());
		log.info("interface-service version is {} ", JSONObject.toJSON(resultData).toString());
	}

	@Override
	public void queryInterfaceVersionFromFeignClient() {
		ResponseData<String> resultData = interfaceVersionFeignClient.testVersion(MDC.get(LogConstant.REQUEST_KEY_TRACEID).toString());
		log.info("interface-service version is {} ", JSONObject.toJSON(resultData).toString());
	}
}
